package com.networkapp;

import android.app.Application;
import android.support.annotation.NonNull;

import com.hu.network.http.HttpClient;
import com.hu.network.http.trustmanager.AccetpAllTrustManager;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Response;
import timber.log.Timber;


/**
 * Created by ASUS on 2017/6/14.
 */

public class AppApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        new HttpClient.Builder().configConnectTimeout(15)
                .configWriteTimeout(10)
                .configCookieAutoManager(this)
                .configTrustAll()
                .configReadTimeout(15)
                .configX509TrustManager(new AccetpAllTrustManager())
                .addInterceptor(new Interceptor() {
                    @Override
                    public Response intercept(@NonNull Chain chain) throws IOException {
                        return chain.proceed(chain.request());
                    }
                }).build();
//        new HTTP.Builder().configConnectTimeout(15)
//                .configWriteTimeout(10)
//                .configCookieAutoManager(this)
//                .configTrustAll()
//                .configReadTimeout(15)
//                .addInterceptor(new Interceptor() {
//                    @Override
//                    public Response intercept(Chain chain) throws IOException {
//                        return null;
//                    }
//                }).build();
        Timber.plant(new Timber.DebugTree());
    }
}
